<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
  <script type="text/javascript">
      /*
          json介绍
            1.定义格式 1：{key:value,key:value,...}
            2.定义格式 2：
                [{key:value,key:value,...},{key:value,key:value,...}，{key:value,key:value,...},...]
            3.定义格式 3：
                {key:value,key:[key:value,key1:value1,...],key:value,...}
       */
        //1.定义格式 1：{key:value,key:value,...}
        let person={"username":"柳岩","age":18,"address":"湖南"};
        //获取person中的湖南并输出
        console.log(person.address);//湖南

        //2.定义格式 ：
        //[{key:value,key:value,...},{key:value,key:value,...}，{key:value,key:value,...},...]
        let arr=[{"username":"柳岩","age":18,"address":"湖南"},{"username":"杨幂","age":20,"address":"北京"}]
        console.log(arr[1].age); 

        //3.定义格式 3：
        //{key:value,key:[key:value,key1:value1,...],key:value,...}
        let person2={"username":"盛哥",student:[{"naame":"孙磊","age":25},{"name":"陈亮","age":15}],"number":"itcast001"};
        //需求 : 获取陈亮并输出
        console.log(person2.student[1].name);
  </script>
</body>
</html>